<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>我的相册</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        .top-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 30px;
            background-color: white;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .top-bar h1 {
            margin: 0;
            font-size: 24px;
            color: #333;
        }
        .user-info {
            position: absolute;
            top: 20px;
            right: 20px;
            background-color: black;
            padding: 10px;
            border-radius: 4px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            cursor: pointer;
        }
        .user-dropdown {
            display: none;
            position: absolute;
            top: 100%;
            right: 0;
            background-color: white;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            border-radius: 4px;
            padding: 10px 0;
            min-width: 150px;
        }
        .user-info:hover .user-dropdown {
            display: block;
        }
        .user-dropdown-item {
            padding: 8px 20px;
            cursor: pointer;
        }
        .user-dropdown-item:hover {
            background-color: #f0f0f0;
        }
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            z-index: 1000;
        }
        .modal-content {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: white;
            padding: 20px;
            border-radius: 4px;
            min-width: 300px;
        }
        .modal-content input {
            width: 100%;
            padding: 8px;
            margin: 10px 0;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .modal-content button {
            padding: 8px 16px;
            margin-right: 10px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .modal-content .confirm-btn {
            background-color: #4CAF50;
            color: white;
        }
        .modal-content .cancel-btn {
            background-color: #f44336;
            color: white;
        }
        .container {
            display: flex;
            height: 100vh;
        }
        .sidebar {
            width: 200px;
            background-color: white;
            padding: 20px;
            box-shadow: 2px 0 5px rgba(0,0,0,0.1);
        }
        .main-content {
            flex: 1;
            padding: 20px;
            margin-left: 20px;
            background-color: white;
            box-shadow: 0 0 5px rgba(0,0,0,0.1);
        }
        .upload-btn {
            width: 100%;
            padding: 8px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            margin-bottom: 12px;
            font-size: 14px;
        }
        .category-list {
            list-style: none;
            padding: 0;
        }
        .category-list li {
            padding: 10px;
            cursor: pointer;
            border-bottom: 1px solid #eee;
        }
        .category-list li:hover {
            background-color: #f0f0f0;
        }
        .photo-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 20px;
            padding: 20px;
        }
        .photo-grid.list-view {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .photo-grid.list-view .photo-item-container {
            display: flex;
            flex-direction: row;
            align-items: center;
            width: 100%;
            padding: 10px;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .photo-grid.list-view .photo-item {
            width: 100px;
            height: 100px;
            margin-right: 20px;
        }
        .photo-grid.list-view .photo-name {
            margin: 0;
            font-size: 16px;
            flex-grow: 1;
        }
        .photo-grid.list-view .photo-uploader {
            margin-left: auto;
            margin-right: 20px;
        }
        .photo-grid.list-view .photo-actions {
            position: static;
            display: flex;
            background: none;
            padding: 0;
        }
        .photo-grid.list-view .action-btn {
            color: #666;
            padding: 5px 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            margin-left: 10px;
        }
        .photo-name {
            margin-top: 0;
            text-align: left;
        }
        .view-toggle-btn {
            padding: 8px 16px;
            border: 1px solid #ddd;
            border-radius: 4px;
            background-color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 14px;
            color: #333;
        }
        .view-toggle-btn:hover {
            background-color: #f0f0f0;
        }
        .photo-item-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            position: relative;
        }
        .photo-item {
            width: 100%;
            aspect-ratio: 1;
            object-fit: cover;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            cursor: pointer;
        }
        .photo-name {
            margin-top: 8px;
            text-align: center;
            font-size: 14px;
            color: #333;
        }
        .photo-actions {
            display: none;
            position: absolute;
            top: 5px;
            right: 5px;
            background-color: rgba(0, 0, 0, 0.7);
            border-radius: 4px;
            padding: 5px;
        }
        .photo-item-container:hover .photo-actions {
            display: flex;
            gap: 5px;
        }
        .action-btn {
            background: none;
            border: none;
            color: white;
            cursor: pointer;
            padding: 5px;
            font-size: 14px;
        }
        .action-btn:hover {
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
        }
        .search-sort-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding: 0 20px;
            gap: 10px;
        }
        .search-box {
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            width: 200px;
        }
        .sort-select {
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            background-color: white;
        }
        .photo-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.8);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }
        .photo-modal-content {
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            max-width: 80%;
            max-height: 80%;
            overflow: auto;
        }
        .photo-modal img {
            max-width: 100%;
            max-height: 70vh;
        }
        .photo-details {
            margin-top: 20px;
        }
        .category-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
            margin: 20px 0;
        }
        .category-item {
            padding: 15px;
            text-align: center;
            background-color: #f5f5f5;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .category-item:hover {
            background-color: #e0e0e0;
        }
        .groups-modal {
            max-width: 800px;
            padding: 30px;
            background-color: #ffffff;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        }

        .member-list {
            margin: 20px 0;
            background-color: #f8f9fa;
            border-radius: 8px;
            padding: 15px;
        }

        .member-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px;
            border-bottom: 1px solid #e9ecef;
            transition: background-color 0.2s;
        }

        .member-item:last-child {
            border-bottom: none;
        }

        .member-item:hover {
            background-color: #e9ecef;
        }

        .member-name {
            font-weight: 500;
            color: #2c3e50;
        }

        .member-join-time {
            color: #7f8c8d;
            font-size: 0.9em;
        }

        .modal-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 20px;
        }

        .modal-btn {
            padding: 10px 20px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 500;
            transition: all 0.3s ease;
            background-color: #95a5a6;
            color: white;
        }

        .modal-btn:hover {
            background-color: #7f8c8d;
        }

        .invite-btn {
            background-color: #95a5a6;
            color: white;
        }

        .invite-btn:hover {
            background-color: #7f8c8d;
        }

        .close-modal-btn {
            background-color: #95a5a6;
            color: white;
        }

        .close-modal-btn:hover {
            background-color: #7f8c8d;
        }

        .groups-modal h3 {
            font-size: 24px;
            color: #2c3e50;
            margin-bottom: 25px;
            font-weight: 600;
        }

        .groups-modal h4 {
            font-size: 18px;
            color: #34495e;
            margin: 20px 0 15px;
            font-weight: 500;
        }

        .create-group-btn {
            background-color: #4CAF50;
            color: white;
            padding: 12px 24px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 500;
            transition: all 0.3s ease;
            margin-bottom: 25px;
            box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
        }

        .create-group-btn:hover {
            background-color: #45a049;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
        }

        .group-list {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .group-item {
            background-color: #f8f9fa;
            border-radius: 8px;
            padding: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        }

        .group-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }

        .group-info {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .group-name {
            font-size: 14px;
            color: #7f8c8d;
        }

        .member-count {
            font-size: 14px;
            color: #7f8c8d;
        }

        .group-actions {
            display: flex;
            gap: 10px;
        }

        .group-actions button {
            padding: 8px 16px;
            border: none;
            margin-left: 30px;
            border-radius: 15px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .group-actions button:first-child {
            background-color: #e74c3c;
            color: white;
        }

        .group-actions button:first-child:hover {
            background-color: #c0392b;
        }

        .group-actions button:last-child {
            background-color: #3498db;
            color: white;
        }

        .group-actions button:last-child:hover {
            background-color: #2980b9;
        }

        .close-btn {
            background-color: #95a5a6;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 500;
            transition: all 0.3s ease;
            margin-top: 2px;
        }

        .close-btn:hover {
            background-color: #7f8c8d;
        }

        .no-groups {
            text-align: center;
            color: #95a5a6;
            font-size: 16px;
            margin: 20px 0;
        }
    </style>
</head>
<body>
    <div class="top-bar">
        <h1>我的相册</h1>
        <div class="user-info" id="userInfo">
            <span id="username"></span>
            <div class="user-dropdown">
                <div class="user-dropdown-item" onclick="showChangePasswordModal()">修改密码</div>
                <div class="user-dropdown-item" onclick="showUserInfoModal()">用户信息</div>
                <div class="user-dropdown-item" onclick="logout()">退出登录</div>
            </div>
        </div>
    </div>
    <div class="modal" id="userInfoModal">
        <div class="modal-content">
            <h3 style="color: #2c3e50; margin-bottom: 20px;">用户信息</h3>
            <div id="userInfoDetails" class="user-info-details">
                <div class="user-info-item">
                    <div class="user-info-label">用户ID</div>
                    <div class="user-info-value">1</div>
                </div>
                <div class="user-info-item">
                    <div class="user-info-label">用户名</div>
                    <div class="user-info-value">root</div>
                </div>
                <div class="user-info-item">
                    <div class="user-info-label">注册时间</div>
                    <div class="user-info-value">2025/1/31 15:49:04</div>
                </div>
                <div class="user-info-item">
                    <div class="user-info-label">加入的分组数</div>
                    <div class="user-info-value">2</div>
                </div>
                <div class="user-info-item">
                    <div class="user-info-label">创建的分组数</div>
                    <div class="user-info-value">2</div>
                </div>
            </div>
            <button class="cancel-btn" onclick="closeUserInfoModal()">关闭</button>
        </div>
    </div>
    <div class="modal" id="changePasswordModal">
        <div class="modal-content">
            <h3>修改密码</h3>
            <input type="password" id="oldPassword" placeholder="请输入旧密码">
            <input type="password" id="newPassword" placeholder="请输入新密码">
            <button class="confirm-btn" onclick="changePassword()">确认</button>
            <button class="cancel-btn" onclick="closeModal()">取消</button>
        </div>
    </div>
    <div class="container">
        <div class="sidebar">
            <button class="upload-btn" id="uploadBtn">上传照片</button>
            <button class="upload-btn" onclick="showGroups()">查看分组</button>
            <h3>相册分类</h3>
            <ul class="category-list" id="categoryList">
                <li>全部照片</li>
                <li>家庭相册</li>
                <li>旅行照片</li>
                <li>其他</li>
            </ul>
        </div>
        <div class="main-content">
            <div class="search-sort-container">
                <input type="text" id="photoSearch" class="search-box" placeholder="搜索照片...">
                <select id="photoSort" class="sort-select">
                    <option value="date-desc">时间降序</option>
                    <option value="date-asc">时间升序</option>
                    <option value="name-asc">名称升序</option>
                    <option value="name-desc">名称降序</option>
                </select>
                <button id="viewToggleBtn" class="view-toggle-btn">
                    <span class="view-icon">📋</span>
                    <span class="view-text">列表视图</span>
                </button>
            </div>
            <div class="photo-grid" id="photoGrid">
                <!-- 照片内容将在这里动态加载 -->
            </div>
        </div>
    </div>
    <div class="photo-modal" id="photoModal">
            <div class="photo-modal-content">
                <img id="modalImage" src="">
                <div class="photo-details" id="photoDetails"></div>
                <div class="modal-actions">
                    <button class="cancel-btn" onclick="downloadPhoto()">下载</button>
                    <button class="cancel-btn" onclick="closePhotoModal()">关闭</button>
                </div>
            </div>
        </div>
        <div class="modal" id="renameModal">
            <div class="modal-content">
                <h3>重命名照片</h3>
                <input type="text" id="newPhotoName" placeholder="请输入新的文件名">
                <button class="confirm-btn" onclick="confirmRename()">确认</button>
                <button class="cancel-btn" onclick="closeRenameModal()">取消</button>
            </div>
        </div>
    </div>
    <script src="renderer.js"></script>
</body>
</html>